Set up the tissue sample and allow for internal duplication.
Add two mutants and let the second one sweep the first one.
sim$add_mutant(name = "Clone 1", growth_rates = .5, death_rates = 0.01)
sim$place_cell("Clone 1", 500, 500)
invisible(sim <- run_up_to_size_by_steps(sim, "Clone 1", 1000, dt))
sim$add_mutant("Clone 2",growth_rates = 1, death_rates = 0.01)
sim$mutate_progeny(sim$choose_cell_in("Clone 1"), "Clone 2")
sim <- sweep_population(sim, "Clone 1", "Clone 2", .5, first_reduction = 10, delta_time = dt)
plot_tissue(sim) | plot_muller(sim)We add the final mutant, i.e. the one that will sweep out the other two completely.
sim$add_mutant("Clone 3",growth_rates = 2, death_rates = 0.01)
sim$mutate_progeny(sim$choose_cell_in("Clone 2"), "Clone 3")
sim <- sweep_population(sim, "Clone 2", "Clone 3", .75, first_reduction = 10, delta_time = dt)
sim <- run_up_to_size_by_steps(sim, "Clone 3", .75e5, dt)
plot_tissue(sim) | plot_muller(sim)We take the first sample of cells. All cells comes from the last mutant.
n_w <- n_h <- 50
ncells <- .99*n_w*n_h
bbox <- sim$search_sample(c("Clone 3" = ncells), n_w, n_h)
sim$sample_cells("A", bbox$lower_corner, bbox$upper_corner)
plot_tissue(sim)We not “treat” our tumor which means that the population dies out for a period of time.
treatment_start <- sim$get_clock()
sim$update_rates("Clone 1",rates = c(growth = 0, death=5))
sim$update_rates("Clone 2",rates = c(growth = 0, death=5))
sim$update_rates("Clone 3",rates = c(growth = 0, death=5))
sim <- run_down_to_size_by_steps(sim, "Clone 3", 1e3, delta_time = .1)
treatment_end <- sim$get_clock()
plot_tissue(sim) | plot_muller(sim)The effect of the treatment ends and the population can grow back.
sim$update_rates("Clone 3",rates = c(growth = 2, death=0.01))
sim <- run_up_to_size_by_steps(sim, "Clone 3", .75e5, delta_time = .1)
plot_tissue(sim, num_of_bins = 300) | plot_muller(sim) + xlim(20, NA)